import * as Cache from 'common/cache'

const mutations = {
  add(state, m) {
    state.count += m
  },
  reduce(state, n) {
    console.log('n:', n)
    state.count -= n
  },
  setCurrentUser(state, currentUser) {
    state.currentUser = currentUser
    Cache.saveCurrentUser(currentUser)
  },
  setAccessToken(state, accessToken) {
    state.accessToken = accessToken
    Cache.saveAccessToken(accessToken)
  },
  setLoginName(state, loginName) {
    state.loginName = loginName
    Cache.saveLoginName(loginName)
  },
  setLastLoginTime(state, lastLoginTime) {
    state.lastLoginTime = lastLoginTime
    Cache.saveLastLoginTime(lastLoginTime)
  }
}

export default mutations
